package com.example.demo.controller.response;

import com.example.demo.common.ResponseCode;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult {
    /**
     * 返回状态码
     */
    @JsonProperty("code")
    private Integer code;
    /**
     * 返回信息
     */
    @JsonProperty("msg")
    private String msg;
    /**
     * 数据
     */
    @JsonProperty("data")
    private Object data;

    public ResponseResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResponseResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseResult(ResponseCode responseCode) {
        this.code = responseCode.getCode();
        this.msg = responseCode.getMsg();
    }
}
